/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.core.listener;

import com.haulmont.asu.entity.CathedralConsultant;
import com.haulmont.cuba.core.listener.BeforeInsertEntityListener;
import com.haulmont.cuba.core.listener.BeforeUpdateEntityListener;

/**
 * Author: Sergey42
 * Date: 30.11.13 19:08
 */
public class CathedralConsultantListener implements
        BeforeInsertEntityListener<CathedralConsultant>,
        BeforeUpdateEntityListener<CathedralConsultant> {

    @Override
    public void onBeforeInsert(CathedralConsultant entity) {
        entity.setCathedra(entity.getCathedralEmployee().getCathedra());
    }

    @Override
    public void onBeforeUpdate(CathedralConsultant entity) {
        onBeforeInsert(entity);
    }
}
